package com.shu.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shu.dao.StudentDao;
import com.shu.entity.Student;
import com.shu.service.StudentService;

@Transactional
@Service("studentService")
public class StudentServiceImpl implements StudentService{
	
	@Autowired
	private StudentDao studentDao;
	
	@Override
	public void addStudent(String name, String course, int score) {
		Student student = new Student();
		student.setName(name);
		student.setCourse(course);
		student.setScore(score);
		studentDao.insertStudent(student);
	}

	@Override
	public float findMaxByCourse(String course) {
		float maxScore = studentDao.countMaxScore(course);
		return maxScore;
	}

	@Override
	public List<Student> findMaxByCourseList(String course) {
		// TODO Auto-generated method stub
		return studentDao.countMaxScoreList(course);
	}

}
